package cn.yudao.ymcc.feign;

import cn.yudao.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


@Component
public class MediaFileFeignFallbackFactory implements FallbackFactory<MediaFileFeign> {


    @Override
    public MediaFileFeign create(Throwable throwable) {
        ExecutorService executorService = Executors.newFixedThreadPool(8);
        return new MediaFileFeign() {
            @Override
            public JSONResult loadMediaByCourseId(Long courseId) {
                throwable.printStackTrace();
                return JSONResult.error("网络波动异常");
            }

            @Override
            public JSONResult getMediaById(Long id) {
                throwable.printStackTrace();
                return JSONResult.error("网络波动异常");
            }
        };
    }
}
